﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotel_Project.Tools.MySqlData_Helps
{
    /// <summary>
    /// 连接MySql数据库的类
    /// </summary>
    internal class ConnectionMySql
    {
        /// <summary>
        /// 连接数据库，返回连接成功之后MySqlConnection数据库连接对象，一定要下载MySql包
        /// </summary>
        /// <param name="mySqlconnand">MySql连接语句</param>
        /// <returns></returns>
        public async static Task<MySqlConnection> Connection(string mySqlconnand)
        {
            using (var conn = new MySqlConnection(mySqlconnand))
            {
                //异步建立连接
                await conn.OpenAsync();
                return conn;
            }
        }
    }
}
